﻿@using System.Threading.Tasks
@using MVlog.Authorization
@using MVlog.Web.Areas.AppAreaName.Startup
@{
    ViewBag.CurrentPageName = AppAreaNamePageNames.Common.OrganizationUnits;
}
@section Styles
{
    <environment names="Development">
        <link rel="stylesheet" href="~/view-resources/Areas/AppAreaName/Views/OrganizationUnits/Index.css" asp-append-version="true" />
    </environment>

    <environment names="Staging,Production">
        <link rel="stylesheet" href="~/view-resources/Areas/AppAreaName/Views/OrganizationUnits/Index.min.css" asp-append-version="true" />
    </environment>
}
@section Scripts
{
    <environment names="Development">
        <script src="~/view-resources/Areas/AppAreaName/Views/OrganizationUnits/Index.js" asp-append-version="true"></script>
    </environment>

    <environment names="Staging,Production">
        <script src="~/view-resources/Areas/AppAreaName/Views/OrganizationUnits/Index.min.js" asp-append-version="true"></script>
    </environment>
}
<div class="row margin-bottom-5">
    <div class="col-xs-12">
        <div class="page-head">
            <div class="page-title">
                <h1>
                    <span>@L("OrganizationUnits")</span> <small>@L("OrganizationUnitsHeaderInfo")</small>
                </h1>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-lg-6">
        <div class="portlet light">
            <div class="portlet-title">
                <div class="caption">
                    <span class="caption-subject bold uppercase">
                        @L("OrganizationTree")
                    </span>
                </div>
                <div class="actions">
                    @if (IsGranted(AppPermissions.Pages_Administration_OrganizationUnits_ManageOrganizationTree))
                    {
                        <a id="AddRootUnitButton" class="btn btn-circle green-haze">
                            <i class="fa fa-plus"></i> @L("AddRootUnit")
                        </a>
                    }
                </div>
            </div>
            <div class="portlet-body">
                <div id="OrganizationUnitEditTree"></div>
                <div id="OrganizationUnitTreeEmptyInfo" ng-if="!vm.organizationTree.unitCount" class="text-muted">
                    @L("NoOrganizationUnitDefinedYet")
                </div>
            </div>
        </div>
    </div>
    <div class="col-lg-6">
        <div class="portlet light">
            <div class="portlet-title">
                <div class="caption">
                    <span class="caption-subject bold uppercase">
                        @L("Members")
                        <span id="SelectedOuRightTitle"></span>
                    </span>
                </div>
                <div class="actions">
                    @if (IsGranted(AppPermissions.Pages_Administration_OrganizationUnits_ManageMembers))
                    {
                        <a id="AddUserToOuButton" class="btn btn-circle blue" style="display:none">
                            <i class="fa fa-plus"></i> @L("AddMember")
                        </a>
                    }
                </div>
            </div>
            <div class="portlet-body">
                <div id="OuMembersTable" style="display:none">
                    <table class="organization-members-table display table table-striped table-bordered table-hover dt-responsive nowrap">
                        <thead>
                            <tr>
                                <th></th>
                                <th>@L("UserName")</th>
                                <th>@L("AddedTime")</th>
                            </tr>
                        </thead>
                    </table>
                </div>

                <div id="OuMembersEmptyInfo" class="text-muted">
                    @L("SelectAnOrganizationUnitToSeeMembers")
                </div>
            </div>
        </div>
    </div>
</div>
